<style>
    body {
        background-color: #ffffff;
    }

    .xm-select-size {
        width: 200px;
        float: left;
    }
</style>
<div class="layui-form layuimini-form">
    <div class="layui-form-item">
        <label class="layui-form-label required">标题</label>
        <div class="layui-input-block">
            <input type="text" name="title" lay-verify="required" lay-reqtext="名称不能为空" placeholder="请输入名称" value=""
                   class="layui-input">
            <tip></tip>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">作者</label>
        <div class="layui-input-block">
            <input type="text" name="author" lay-verify="required" lay-reqtext="作者不能为空" placeholder="请输入作者" value=""
                   class="layui-input">
            <tip></tip>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">内容</label>
        <div class="layui-input-block">
            <textarea name="description" id="description" class="" placeholder="请输入内容"></textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
        </div>
    </div>
</div>
<script type="text/javascript" src="/static/extends/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="/static/extends/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
    layui.config({
        base: '/static/extends/'
    }).extend({
        xmSelect: 'xmSelect/xm-select'
    });
    layui.use(['form', 'xmSelect', "upload", "element"], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$,
            xmSelect = layui.xmSelect,
            upload = layui.upload,
            element = layui.element;

        var ue = UE.getEditor('description');
        //监听提交
        form.on('submit(saveBtn)', function (data) {
            data.field['description'] = ue.getContent();
            hadmin.http("{:url('save')}", data.field).then(res => {
                if (res.code == "{$result.normal}") {
                    hadmin.father_reload();
                }
            })

            return false;
        });


    });
</script>
</body>
</html>